/*
 * @Author:Iyoole
 * @Time  :2018-01-29
 * @Description:表格
 * @git:
 * */

;!function(e) {
    "use strict";
    var i,r={
        index:0
    };
    var Table=function(m){
        this.elem=i(m);
        r.index++
    };
    Table.pt=Table.prototype;
    Table.pt.dot=function(d,k){
        var t=this,m=t.config.map[k];
        if(!m) return d[k];
        var nm=m.split('.'),nd=d;
        for(var x in nm){
            try{
                nd=nd[nm[x]]
            }catch (e){
                nd=''
            }
        }
        return nd||''
    };
    Table.pt.render=function(opts){
        var t=this,od={
            limit:10,
            align:'left',
            cellWidth:60,
            code:1,
            fixedNum:1,
            map:{},
            fixedCol:[]
        };
        t.cache={
            fixed:{
                width:0,
                col:[]
            },
            normal:{
                width:0,
                col:[]
            },
            auto:{
                width:0,
                col:[]
            },
            checked:[],
            tHead:{}
        };
        t.cache.cols=i.extend(true,[],opts.cols);
        t.config=i.extend({},od,opts);
        var _c=t.config,_cache=t.cache;
        _c.index=r.index;
        if(_c.fixed&&_c.fixed!='left'&&_c.fixed!='right'){
            return console.error('fixed值不对');
        }
        _c.fixed?(_cache.fixed.width=_c.code?_c.checkbox?86:61:0):(_cache.normal.width=_c.code?_c.checkbox?86:61:0);
        i.each(_c.cols,function(x,y){
            y.fieldName=y.fieldName||y.field;
            _cache.tHead[y.fieldName]={field:y.field,title:y.title?y.title:y.fieldName};
            if(_c.fixed){
                if(_c.code){
                    if(_c.fixedNum>1&&x<(_c.fixedNum-1)){
                        _cache.fixed.col.push(y);
                        _cache.fixed.width+=1;
                        if(!y.width){
                            _cache.cols[x]['width']=_c.cellWidth
                        }
                        _cache.fixed.width+=y.width||_c.cellWidth
                    }else{
                        _cache.normal.col.push(y);
                        if(y.width){
                            _cache.normal.width+=y.width
                        }else{
                            _cache.auto.col.push(y)
                        }
                    }
                }else{
                    if(x<(_c.fixedNum)){
                        _cache.fixed.col.push(y);
                        _cache.fixed.width+=1;
                        if(!y.width){
                            _cache.cols[x]['width']=_c.cellWidth
                        }
                        _cache.fixed.width+=y.width||_c.cellWidth
                    }else{
                        _cache.normal.col.push(y);
                        if(y.width){
                            _cache.normal.width+=y.width
                        }else{
                            _cache.auto.col.push(y)
                        }
                    }
                }
            }else{
                _cache.normal.col.push(y);
                if(y.width){
                    _cache.normal.width+=y.width
                }else{
                    _cache.auto.col.push(y)
                }
            }
        });
        _cache.borderWidth=_cache.normal['col'].length+1;
        t.setWidth();//宽度分配
        t.create();//创建结构
        t.data();//数据处理
        t.events();//事件处理
        return t;
    };
    Table.pt.setWidth=function(){
        var t=this,_c=t.config,_cache=t.cache,pw=function(){
            var getWidth=function(parent){
                var width,isNone;
                parent=parent||t.elem;
                width=parent.width();
                try{
                    isNone=parent.css('display')==='none'
                }catch (e){}
                if(parent[0]&&(!width||isNone)) return getWidth(parent.parent());
                return width
            };
            return getWidth()
        }(),diff=pw-(_cache.fixed.width+_cache.normal.width+_cache.borderWidth+_cache.auto.col.length*_c.cellWidth);
        var sw=t.getScrollWidth();//滚动条宽度
        if(diff>0){//有剩余宽度
            if(_cache.auto.col.length>0){
                var aLen=diff>=sw?(diff-sw)/_cache.auto.col.length:0;
                i.each(_cache.auto.col,function(x,y){
                    y['width']=_c.cellWidth+aLen
                });
                _cache.adjustName=_cache.auto.col[0]['fieldName'];
                _cache.auto.col[0]['width']+=(diff-sw>=0?sw:diff)
            }else{
                _cache.adjustName=_cache.normal.col[_cache.normal.col.length-1]['fieldName'];
                if(diff>=sw){
                    var bLen=(diff-sw)/_cache.normal.col.length;
                    i.each(_cache.normal.col,function(x,y){
                        y['width']+=bLen
                    });
                    _cache.normal.col[_cache.normal.col.length-1]['width']+=sw;
                }else{
                    _cache.normal.col[_cache.normal.col.length-1]['width']+=diff;
                }
            }
            _cache.crossScroll=diff>=sw?0:1;
            _cache.boxWidth=pw-_cache.fixed.width-1
        }else{
            _cache.crossScroll=1;
            _cache.adjustName=_cache.normal.col[_cache.normal.col.length-1]['fieldName'];
            i.each(_cache.auto.col,function(x,y){
                y['width']=_c.cellWidth
            });
            _cache.boxWidth=_cache.normal.width+_cache.borderWidth+_cache.auto.col.length*_c.cellWidth-1
        }
    };
    Table.pt.create=function(){
        var t=this,_cache=t.cache,_c=t.config;
        t.elem.empty();
        var $view=i('<div/>').addClass('fui-table-view').appendTo(t.elem);
        if(_cache.fixed.width!=0){
            t.$Fixed=i('<div/>').addClass('fui-table-fixed fui-table-fixed-'+_c.fixed).appendTo($view);
            t.$Box=i('<div/>').addClass('fui-table-box fui-'+_c.index+'-box').appendTo($view);
            t.$FixedHeader=i('<div/>').addClass('fui-table-header').append('<div class="fui-table"><div class="fui-table-tr">'+function(){
                    var th=_c.code?('<div class="fui-table-th">'+function(){
                        return  _c.checkbox?'<div class="fui-table-cell fui-table-checkbox fui-table-checkAll" data-checkbox="'+t.config.index+'"><input type="checkbox">全选</div>':'<div class="fui-table-cell fui-table-code">序号</div>'
                    }()+'</div>'):'';
                    i.each(_cache.fixed.col,function(x,y){
                        th+='<div class="fui-table-th" data-field="'+y.fieldName+'"><div class="fui-table-cell fuiTable-cell-'+_c.index+'-'+y.fieldName+' fui-table-align-'+(y.align?y.align:_c.align)+'" '+function(){
                           return y.sort?'data-sort="'+y.fieldName+'"':''
                        }()+'>'+function(){
                            return y.filter?(y.title!=null?y.title:y.fieldName)+'<a href="javascript:;" class="fui-filter-sort" title="数据过滤"><i class="fui-font fui-font-filter"></i></a>':(y.title!=null?y.title:y.fieldName)
                        }()+'</div></div>'
                    });
                    return th
                }()+'</div></div>').appendTo(t.$Fixed);
            t.$FixedBody=i('<div/>').addClass('fui-table-body').append('<div class="fui-table"></div>').appendTo(t.$Fixed)
        }else{
            t.$Box=i('<div/>').addClass('fui-table-box fui-'+_c.index+'-box').appendTo($view)
        }
        t.$MainHeader=i('<div/>').addClass('fui-table-header').append('<div class="fui-table"><div class="fui-table-tr">'+function(){
               var th=_c.fixed?'':(_c.code?('<div class="fui-table-th">'+function(){
                   return  _c.checkbox?'<div class="fui-table-cell fui-table-checkbox fui-table-checkAll" data-checkbox="'+t.config.index+'"><input type="checkbox">全选</div>':'<div class="fui-table-cell fui-table-code">序号</div>'
               }()+'</div>'):'');
                i.each(_cache.normal.col,function(x,y){
                    th+='<div class="fui-table-th" data-field="'+y.fieldName+'"><div class="fui-table-cell fuiTable-cell-'+_c.index+'-'+y.fieldName+' fui-table-align-'+(y.align?y.align:_c.align)+'" '+function(){
                            return y.sort?'data-sort="'+y.fieldName+'"':''
                        }()+'>'+function(){
                            return y.filter?(y.title!=null?y.title:y.fieldName)+'<a href="javascript:;" class="fui-filter-sort" title="数据过滤"><i class="fui-font fui-font-filter"></i></a>':(y.title!=null?y.title:y.fieldName)
                        }()+'</div></div>'
                });
                return th
            }()+'</div></div>').appendTo(t.$Box);
        t.$MainBody=i('<div/>').addClass('fui-table-body').append('<div class="fui-table"></div>').appendTo(t.$Box);
        var style='<style>'+function(){
                var sCss='';
                i.each(_cache.fixed.col,function(x,y){
                    sCss+=".fuiTable-cell-"+_c.index+"-"+y.fieldName+"{width:"+y.width+"px}"
                });
                i.each(_cache.normal.col,function(x,y){
                    sCss+=".fuiTable-cell-"+_c.index+"-"+y.fieldName+"{width:"+y.width+"px}"
                });
                if(_c.fixed) sCss+=".fui-"+_c.index+"-box{margin-left:"+_cache.fixed.width+"px}";
                sCss+=".fui-"+_c.index+"-box .fui-table{width:"+_cache.boxWidth+"px}";
                return sCss
            }()+'</style>';
        $view.append(style)
    };
    Table.pt.data=function(){
        var t=this,_c=t.config;
        if(_c['staticData']){
            var sLen=_c['staticData']['records'].length;
            sLen>_c.limit && t.pageShow(sLen);
            t.renderData(_c['staticData']['records'],1)
        }else{
            t.pullData();
        }
    };
    Table.pt.pageShow=function(ps){
        var t=this;
        t.page=true;
        if(!t.elem.find('.tablePage')[0]){
            t.$page=i('<div/>').addClass('tablePage').attr({'page-max':5,'page-list':t.config.limit}).appendTo(t.elem);
        }else{
            t.$page=t.elem.find('.tablePage')
        }
        if(JsPage){
            JsPage('.tablePage').render(ps,1,function(np){
                t.pullData(np)
            });
        }else{
            layer?layer.msg('请引入JsPage模块'):console.error('请引入JsPage模块')
        }
    };
    Table.pt.pullData=function(pn){
        var t=this,_c=t.config,od={page:1||pn};
        i.ajax({
            type:_c.method||'get',
            url:_c.url,
            dataType:'json',
            data:i.extend(true,{},od,_c.data),
            success:function(rs){
                if(rs.code==1){
                    if(od.page==1&&rs['total']>_c.limit){
                        t.pageShow(rs['total'])
                    }
                    t.renderData(rs['records'],od.page)
                }else{
                    layer?layer.msg('返回数据异常!'):console.error('返回数据异常!');
                }
            },
            error:function(){
                layer?layer.msg('返回数据异常!'):console.error('返回数据异常!');
            }
        })
    };
    Table.pt.renderData=function(rd,pn){
        var t=this,_c=t.config,_cache=t.cache,fTr='',bTr='';
        _cache.data=rd;//缓存本次数据
        _cache.checked=[];//清空之前已选记录
        i.each(rd,function(x,y){
            var code=(pn-1)*_c.limit+x+1;
            if(t.$FixedBody){
                fTr+='<div class="fui-table-tr">'+function(){
                        var iTd=_c.code?('<div class="fui-table-td">'+function(){
                            return  _c.checkbox?'<div class="fui-table-cell fui-table-checkbox" data-checkbox="'+_c.index+'"><input type="checkbox">'+code+'</div>':'<div class="fui-table-cell fui-table-code">'+code+'</div>'
                        }()+'</div>'):'';
                        i.each(_cache.fixed.col,function(m,n){
                            var nv=n.fun?n.fun(t.dot(y,n.field)):t.dot(y,n.field),cn=n.className?'fui-td-'+n.className:'';
                            nv=nv?nv:n.noText?n.noText:"";
                            iTd+='<div class="fui-table-td '+cn+'"><div class="fui-table-cell fuiTable-cell-'+_c.index+'-'+n.fieldName+' fui-table-align-'+(y.align?y.align:_c.align)+'">'+nv+'</div></div>'
                        });
                        return iTd
                    }()+'</div>';
            }
            var onClick=_c.event?'onclick="'+_c.event+'(this,'+x+')"':'';
            bTr+='<div class="fui-table-tr" '+onClick+'>'+function(){
                    var iTd=t.$FixedBody?'':_c.code?('<div class="fui-table-td">'+function(){
                        return  _c.checkbox?'<div class="fui-table-cell fui-table-checkbox" data-checkbox="'+_c.index+'"><input type="checkbox">'+code+'</div>':'<div class="fui-table-cell fui-table-code">'+code+'</div>'
                    }()+'</div>'):'';
                    i.each(_cache.normal.col,function(m,n){
                        var nv=n.fun?n.fun(t.dot(y,n.field)):t.dot(y,n.field),cn=n.className?'fui-td-'+n.className:'';
                        nv=nv?nv:n.noText?n.noText:"";
                        iTd+='<div class="fui-table-td '+cn+'"><div class="fui-table-cell fuiTable-cell-'+_c.index+'-'+n.fieldName+' fui-table-align-'+(y.align?y.align:_c.align)+'">'+nv+'</div></div>'
                    });
                    return iTd
                }()+'</div>';
        });
        t.$FixedBody&&t.$FixedBody.find('.fui-table').empty().append(fTr);
        t.$MainBody.find('.fui-table').empty().append(bTr);
        t.setHeight();
        t.scrollPatch();
    };
    Table.pt.setHeight=function(){
        var t=this,_c=t.config,_wh=i(window).height(),$Body=t.elem.find('.fui-table-body'),height,hh=t.elem.find('.fui-table-box .fui-table-header').outerHeight();
        if(_c.height){
            if(/^full-\d+$/.test(_c.height)){
                height=_wh-_c.height.split('-')[1];
            }else{
                height=_c.height
            }
            if(t.page) height-=50;
            height=height-hh>100?height-hh:100;
            $Body.css({'height':height})
        }else{
            height=_wh;
            if(t.page) height-=50;
            height=height-hh>100?height-hh:100;
            $Body.css({'max-height':height})
        }
    };
    //获取cssRule
    Table.pt.getCssRule = function(field,c){
        var t = this
            ,style = t.elem.find('style')[0]
            ,sheet = style.sheet || style.styleSheet || {}
            ,rules = sheet.cssRules || sheet.rules;
        var st=!field?'.fui-'+t.config.index+'-box .fui-table':'.fuiTable-cell-'+t.config.index+'-'+field;
        i.each(rules,function(m,n){
            if(n.selectorText===st){
                return c(n),true;
            }
        });
    };
    //获取滚动条宽度
    Table.pt.getScrollWidth = function(elem){
        var width = 0;
        if(elem){
            width = elem.offsetWidth - elem.clientWidth;
        } else {
            elem = document.createElement('div');
            elem.style.width = '100px';
            elem.style.height = '100px';
            elem.style.overflowY = 'scroll';
            document.body.appendChild(elem);
            width = elem.offsetWidth - elem.clientWidth;
            document.body.removeChild(elem);
        }
        return width;
    };
    Table.pt.scrollPatch=function(){
        var t=this,_c=t.config,_cache=t.cache,sw=t.$MainBody.width()-t.$MainBody.prop('clientWidth'),sh=t.$MainBody.height()-t.$MainBody.prop('clientHeight');
        if(_cache.crossScroll!=1&&!t.scrollPatchWStatus){
            t.getCssRule(_cache.adjustName,function(item){
                var ow=parseFloat(item.style.width);
                item.style.width=(ow-sw)+'px';
            });
            t.getCssRule('',function(tb){
                tb.style.width=(parseFloat(tb.style.width)-sw) +'px'
            });
            t.scrollPatchWStatus=true;
        }
        if(sw&&sh){
            if(!t.elem.find('.fui-table-patch')[0]){
                var patchElem=i('<div class="fui-table-patch"><div class="fui-table-cell"></div></div>');
                patchElem.find('div').css({width:sw});
                t.$MainHeader.find('.fui-table-tr').append(patchElem);
            }
            var tbw=t.$Box.find('.fui-table-body .fui-table').outerWidth();
            t.$MainHeader.find('.fui-table').css('width',tbw+sw+1)
        }else{
            t.$MainHeader.find('.fui-table').removeAttr('style');
            t.$MainHeader.find('.fui-table-patch').remove();
        }
        if(_c.fixed){
            if(sh){
                if(!t.elem.find('.fui-table-fixPatch')[0]){
                    var fixPatch=i('<div class="fui-table-tr fui-table-fixPatch"><div class="fui-table-cell"></div></div>');
                    fixPatch.find('div').css({height:sh});
                    t.$FixedBody.find('.fui-table').append(fixPatch)
                }
            }else{
                t.$FixedBody.find('.fui-table-fixPatch').remove();
            }
        }
    };
    Table.pt.events=function(){
        var t=this,_c=t.config,_cache=t.cache,_body=i('body'),dict={},th=t.$MainHeader.find('.fui-table-th');
        th.on('mousemove',function(e){
            var _t=i(this),_of=_t.offset().left,_pf=e.clientX-_of;
            dict.allowResize=_t.width()-_pf<=10;
            _body.css('cursor',(dict.allowResize?'col-resize':''));
        }).on('mouseleave',function(){
            if(dict.resizeStart) return;
            _body.css('cursor','')
        }).on('mousedown',function(e){
            var _t=i(this),fieldName=_t.data('field'),lastName=_cache.normal.col[_cache.normal.col.length-1].fieldName;
            if(dict.allowResize&&lastName!=fieldName){
                e.preventDefault();
                dict.resizeStart=true;
                dict.offsetX=e.clientX;
                dict.minWidth=_cache.cols[_cache.cols.length-1]['width']||_c.cellWidth;
                dict.scrollWidth=t.$MainBody.width()-t.$MainBody.prop('clientWidth');
                t.getCssRule(lastName,function(item){
                    dict.last=item;
                    dict.lastWidth=parseFloat(item.style.width)
                });
                t.getCssRule(fieldName,function(item){
                    dict.rule=item;
                    dict.ruleWidth=parseFloat(item.style.width)
                });
                t.getCssRule('',function(tb){
                    dict.tableBox=tb;
                    dict.tableBoxWidth=parseFloat(tb.style.width)
                });
            }
        });
        i(document).on('mousemove',function(e){
            if(dict.resizeStart){
                e.preventDefault();
                if(dict.rule){
                    var ow=dict.ruleWidth + e.clientX - dict.offsetX;
                    if(ow<_c.cellWidth) ow=_c.cellWidth;
                    dict.rule.style.width=ow+'px';
                    var lw=dict.lastWidth-ow+dict.ruleWidth;
                    if(ow>dict.ruleWidth){
                        if(lw>dict.minWidth){
                            dict.last.style.width=lw +'px';
                        }else{
                            dict.last.style.width=dict.minWidth + 'px';
                            dict.tableBox.style.width=dict.tableBoxWidth + ow-dict.ruleWidth + dict.minWidth - dict.lastWidth +'px';
                        }
                    }else{
                        var m=dict.tableBoxWidth + ow - dict.ruleWidth,n=_cache.boxWidth-dict.scrollWidth;
                        if(m>=n){
                            dict.tableBox.style.width=m +'px';
                        }else{
                            dict.tableBox.style.width=n +'px';
                            dict.last.style.width=lw - dict.tableBoxWidth + n +'px';
                        }
                    }
                    t.scrollPatch();
                }
            }
        }).on('mouseup',function(){
            if(dict.resizeStart){
                dict={};
                _body.css('cursor','');
                t.scrollPatch()
            }
        });
        t.$MainBody.on('scroll',function(){
            var _t=i(this),l=_t.scrollLeft(),top=_t.scrollTop();
            t.$MainHeader.scrollLeft(l);
            t.config.fixed?t.$FixedBody.scrollTop(top):''
        });
        i(window).on('resize',function(){
            var pw=function(){
                var getWidth=function(parent){
                    var width,isNone;
                    parent=parent||t.elem;
                    width=parent.width();
                    try{
                        isNone=parent.css('display')==='none'
                    }catch (e){}
                    if(parent[0]&&(!width||isNone)) return getWidth(parent.parent());
                    return width
                };
                return getWidth()
            }(),nw=pw-_cache.fixed.width-1,sw=t.$MainBody.width()-t.$MainBody.prop('clientWidth'),sh=t.$MainBody.height()-t.$MainBody.prop('clientHeight');
            if(nw-sw>_cache.boxWidth){
                t.getCssRule(_cache.adjustName,function(item){
                    var iw=parseFloat(item.style.width);
                    item.style.width=(iw + nw - sw - _cache.boxWidth) +'px'
                });
                t.getCssRule('',function(tb){
                    tb.style.width=(nw - sw) +'px'
                });
                _cache.boxWidth=nw-sw;
            }
            t.scrollPatch();
        });
        t.elem.find('.fui-table-box .fui-table-tr').on('mousemove',function(){
            var _t=i(this),idx=_t.index();
            t.elem.find('.fui-table-fixed .fui-table-body .fui-table-tr').eq(idx).addClass('trHover').siblings().removeClass('trHover');
            t.elem.find('.fui-table-box .fui-table-body .fui-table-tr').eq(idx).addClass('trHover').siblings().removeClass('trHover')
        }).on('mouseleave',function(){
            t.elem.find('.trHover').removeClass('trHover')
        });
        //checkbox
        t.elem.find('.fui-table-checkbox').on('click',function(e){
            e.stopPropagation();
            var _t=i(this),checkbox=t.elem.find('.fui-table-checkbox[data-checkbox="'+t.config.index+'"]'),checked='fui-table-checked',ckAll=t.elem.find('.fui-table-checkAll[data-checkbox="'+t.config.index+'"]');
            if(_t.hasClass('fui-table-checkAll')){
                if(_t.hasClass(checked)){
                    checkbox.removeClass(checked).find('input').prop('checked',false);
                    t.cache.checked=[]
                }else{
                    checkbox.addClass(checked).find('input').prop('checked',true);
                    t.cache.checked=t.cache.data
                }
            }else{
                var idx=_t.parent('.fui-table-td').parent('.fui-table-tr').index();
                if(_t.hasClass(checked)){
                    _t.removeClass(checked).find('input').prop('checked',false);
                    ckAll.removeClass(checked).find('input').prop('checked',false);
                    t.cache.checked=fui.array.del(t.cache.data[idx],t.cache.checked)
                }else{
                    _t.addClass(checked).find('input').prop('checked',true);
                    if(checkbox.length - 1==t.elem.find('.'+checked).length){
                        ckAll.addClass(checked).find('input').prop('checked',true)
                    }
                    t.cache.checked=fui.array.join(t.cache.data[idx],t.cache.checked)
                }
            }
        });
        //filter
        t.elem.find('.fui-filter-sort').on('click',function(){
            var _t=i(this),field=_t.parents('.fui-table-th').data('field');
            t.config.filterFun&&t.config.filterFun(field,_cache.tHead)
        });
    };
    //数据重载
    Table.pt.reload=function(){
        var t=this;
        t.pullData();
    };
    //复选框回调事件
    Table.pt.checkBack=function(c,p){
        var t=this,pj=[];
        if(p){
            p='object'===typeof p?p:[p];
            for(var j=0;j<p.length;j++){
                pj.push([])
            }
            var fp=function(n,m){
                var nd=n;
                for(var k=0;k<m.length;k++){
                    nd=nd[m[k]]
                }
                return nd||''
            };
            i.each(t.cache.checked,function(x,y){
                i.each(p,function(nx,ny){
                    pj[nx].push(fp(y,ny.split('.')))
                });
            });
        }
        c(t.cache.checked,pj)
    };
    //回调数据(单选,多选可用上面复选框回调)
    Table.pt.dataBack=function(idx,c){
        var t=this;
        if(typeof idx!='number'){
            try{
                idx=parseInt(idx)
            }catch (e){return console.error('查询回调值不正确')}
        }
        var flag='number'===typeof idx&&idx<t.config.limit;
        if(flag||idx==0){
            c(t.cache.data[idx])
        }else{
            console.error('查询回调值不正确')
        }
    };
    var JsTable=function(m){
        return new Table(m)
    };
    JsTable.v='2.01';
    if(window.fui && fui.define ){
        fui.define('jquery', function(exports){
            e.JsTable=JsTable;
            i=fui.$;
            exports('JsTable', JsTable);
        });
    }else{//如果直接引用的话
        e.JsTable=JsTable;
        i=e.jQuery;
    }
}(window);


/*
* 2.01(2018-3-9完成修改)
* 版本更新
* 优化高宽计算,新增部分参数
* */
/*----参数说明----*/
/*
* cols   :----->表头
*     ----field    :数据参数名
*     ----title    :表头名(如果没有取field的值)
*     ----fieldName:样式名(当存在此段时,单元格样式用fieldName取代field---不同于title)
*     ----width    :宽度(选填,当不存在宽度值时,平分剩余宽度,但不会小于最小宽度值)
*     ----fun      :回调方法(回调传出的值为对应field的数据)
*     ----align    :对齐方式('left/right/center',默认为left)
*     ----className:给td额外添加的类名
*     ----noText  :当没有数据时显示noText(默认为空)
*     ----filter   :过滤
*     ----sort     :排序
*
* map    :----->映射表(因后台参数不可能直接为field值,示例{field:参数.参数.field})
*
* height :----->高度(固定值/full-差值/自定义)
*
* fixed  :----->是否固定列(固定列只限左侧(left)/右侧(right))
* fixedNum:---->固定列数(默认1)
*
* checkbox:---->选择框(默认关闭)
* code    :---->序号(默认为开启)
*
* event   :---->行点击事件(外事件)
*
* limit   :---->每页行数(默认10行)
*
* url     :---->数据请求地址
* data    :---->数据参数
* method  :---->请求类型(默认get)
*
* filterFun:--->过滤回调方法
*
* staticData:->静态数据(测试时用到)
* */


